package algorithm;

import java.util.*;
public class IpConvert {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String ip = sc.nextLine();
            String ip10 = sc.nextLine();

            String[] ipArr = ip.split("\\.");
            String end = "";
            for(int i=0;i<ipArr.length;i++){
                end += transTen2Two8(ipArr[i]);
            }
            System.out.println(transTwo2Ten(end));

            String c = transTen2Two(ip10);
            String prefix = "";
            for(int i=0;i<32-c.length();i++){
                prefix += "0";
            }
            String cc = prefix + c;
            StringBuilder stringBuilder = new StringBuilder("");
            for(int i=0;i<cc.length();i=i+8){
                stringBuilder.append(transTwo2Ten(cc.substring(i,i+8))).append(".");
            }
            System.out.println(stringBuilder.deleteCharAt(stringBuilder.lastIndexOf(".")).toString());
        }
    }

    public static String transTen2Two8(String s){
        long[] one = new long[8];
        int index = 7;
        long i = Long.parseLong(s);
        while(i/2 >0 || i%2>0){
            one[index] = i%2;
            i = i/2;
            index--;
        }
        String a = "";
        for(int j=0;j<one.length;j++){
            a += one[j];
        }
        return a;
    }

    public static String transTen2Two(String s){
        StringBuilder stringBuilder = new StringBuilder();
        long i = Long.parseLong(s);
        while(i/2 >0 || i%2>0){
            stringBuilder.insert(0,i%2);
            i = i/2;
        }
        return stringBuilder.toString();
    }

    public static String transTwo2Ten(String s){
        String a = "";
        long temp = 0;
        int b = 0;
        for(int i=0;i<s.length();i++){
            char t = s.charAt(i);
            if (t != '0'){
                b = i;
                break;
            }
        }
        a= s.substring(b,s.length());
        for(int i=s.length()-1;i>=0;i--) {
            int t = s.charAt(i) - '0';
            temp += t * Math.pow(2,s.length() -1 - i);
        }

        return "" + temp;
    }
}
